package org.jwcloud.project.module.zx.bigScreen.controller;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.jwcloud.project.module.zx.bigScreen.service.repository.RptBigScreenRepository;
import org.jwcloud.project.module.zx.common.Resp;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import com.github.pagehelper.PageHelper;
import com.jw.mid.mm.comm.common.controller.BaseController;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;

@Api(value = "API - Controlle",
description = "全流程大屏", tags = "rptBigScreen")
@RestController
@RequestMapping("/rest/rptBigScreen")
public class RptBigScreenController extends BaseController{
	
//	@Autowired
//    private CommonService commonService;
	
	@RequestMapping("/testView")
	public ModelAndView testView(String param1, ModelAndView model) {
//		System.out.println(555);
//		model.addObject("p1", "pp1");
		PageHelper pp;
		model.setViewName("/test/Test.html");
		return model;
	}
	
	@Autowired
	public RptBigScreenRepository rptBigScreenRepository;
	
    //------------
    @GetMapping("queryTitle")
    @ApiOperation(value = "上面4个", 
    notes = "project_num,#在建	warn_num,#超时预警	one_day_num,#当日完成预警"
    +"		warn_one_per,#效率	tip_num,#督办次数	"
    +"tip_fk_num,#督办反馈次数	tip_fk_per,#反馈率"
    +"warning_num未完成任务的预警    tixinging_num未完成任务的提醒")
    @ApiImplicitParams({
    })
    public Resp<Object> queryTitle(
    		@RequestParam(required = false) Map<String,String> param
    		){
        return Resp.success(rptBigScreenRepository.queryTitle(null));
    }
    
    @GetMapping("queryTipBar")
    @ApiOperation(value = "任务督办统计", notes = "")
    @ApiImplicitParams({
    })
    public Resp<Object> queryTipBar(
    		@RequestParam(required = false) Map<String,String> param
    		){
    	return Resp.success(rptBigScreenRepository.queryTipBar(null));
    }
    
    @GetMapping("queryCronPie")
    @ApiOperation(value = "任务超时预警统计", notes = "")
    @ApiImplicitParams({
    })
    public Resp<Object> queryCronPie(
    		@RequestParam(required = false) Map<String,String> param
    		){
    	return Resp.success(rptBigScreenRepository.queryCronPie(null));
    }
    
    @GetMapping("queryMvpItem")
    @ApiOperation(value = "风险要件统计", notes = "")
    @ApiImplicitParams({
    })
    public Resp<Object> queryMvpItem(
    		@RequestParam(required = false) Map<String,String> param
    		){
    	Map res = new HashMap();
    	res.put("queryMvpItemCount", rptBigScreenRepository.queryMvpItemCount(null));
    	res.put("queryMvpItemList", rptBigScreenRepository.queryMvpItemList(null));
    	return Resp.success(res);
    }
    
    @GetMapping("queryProjectList")
    @ApiOperation(value = "项目列表", notes = "")
    @ApiImplicitParams({
    })
    public Resp<Object> queryProjectList(
    		@RequestParam(required = false) Map<String,String> param
    		){
    	//PageHelper.startPage(2, 10);
    	List list = rptBigScreenRepository.queryProjectList(null);
    	return Resp.success(list);
    }
    
}